
/**
 * 人员选择器弹窗
 */
var openpeopleselectWindow =function(conditions,name,valuefield,projectName){
	mini.open({
        url: projectName+"/UserAdmin/peopleselect",
        title: "人员选择器", width: 700, height: 500,
        onload: function () {
            var iframe = this.getIFrameEl();
            var json = {};
            if(conditions){
            	var con = mini.decode(conditions);
            	 for(key in con){
        		   var value = con[key];  // key 为数数据库字段,value为表单字段
        		   if(mini.getbyName(value)){
        			   json[key] = mini.getbyName(value).getValue();
        		   }
        	   }
           }
            iframe.contentWindow.CheckEventUser(json);
        },
        ondestroy: function (action) {
        	if(typeof(action)=="object"  && action.status==1){
        		   //设置人员选择器中的内容
                setPeopleselectInput(action.rows,name,valuefield);
        	}
         
        }
    });
}
//设置人员选择器中的值
function setPeopleselectInput (rtdata,name,valuefield){
	var data = mini.clone(rtdata);
	var valuefield = mini.decode(valuefield);
	var textArr = [];
	for(var i=0; i<data.length; i++){
		textArr.push(data[i].name);
	}
	mini.getbyName(name).setValue(textArr.join(","));
	for(key in valuefield){
		var field = valuefield[key];
		if(mini.getbyName(field)){
			var arr = [];
			for(var i=0; i<data.length; i++){
				var item = data[i];
				arr.push(item[key]);
			}
			mini.getbyName(field).setValue(arr.join(","));
		}
		
	}
}